<?php
class M_team extends CI_Model {
	function M_team(){
		parent::__construct();		
		
	}
	//插入一条数据
	function insert_one($data){
		$db = $this->connect_database();
		 return $db->insert("common_duty",$data);
	}
	//查询1条数据，返回结果
	function query_one($sql){
		$db = $this->connect_database();
		return $db->query($sql)->row_array();
		
	}
	//查询list data
	function querylist($sql){
		$db = $this->connect_database();
		$result =array();
		$query = $db->query($sql);
		if($query){
			foreach($query->result() as $row){
	    		$result[] = $row ;
	    	}		
		}

    	return $result ;
	}
	//查询返回的结果
	function query_count($sql){
		$db = $this->connect_database();
		$query = $db->query($sql);
		return $query->num_rows();
	}
	//连接数据库并且返回句柄
	private function connect_database(){
		return  $this->load->database('real_data',true);
	}
	

}